﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Game : MonoBehaviour {
    [Header("Binding")]
    public _EventManager _EventManager;
    public _TriggerEventManager _TriggerEventManager;

    public Button testStartingButton;
    public Button testFinishButton;

    private bool init = false;

    // Start is called before the first frame update
    void Start() {
        _EventManager.__AttachEvent("LoadingStable", RefreshWindow);

        testStartingButton.onClick.AddListener(ClickStartingButton);
        testFinishButton.onClick.AddListener(ClickFinishButton);

        gameObject.SetActive(false);
    }

    private void Update() {

    }

    //显示窗口控制
    private void RefreshWindow(object loadingType) {
        switch ((LoadingType)loadingType) {
            case LoadingType.Gaming2Finish:
                gameObject.SetActive(false);
                break;

            case LoadingType.Gaming2Starting:
                gameObject.SetActive(false);
                break;

            case LoadingType.Prepare2Gaming:
                gameObject.SetActive(true);
                break;
        }
    }

    private void OnInitGaming(object _player) {

    }

    private void ClickStartingButton() {
        _TriggerEventManager.TriggerEvent("Starting");
    }

    private void ClickFinishButton() {
        _TriggerEventManager.TriggerEvent("Finish");
    }

    //输入
    private void OnShortCut(object shortCut) {
        KeyCode keyCode = (KeyCode)shortCut;

    }
}